package security

import (
	"sync"
)

// StsUploadToken 结构体
type StsUploadToken struct {
	// accessKeyId
	AccessKeyId string `json:"access_key_id,omitempty" xml:"access_key_id,omitempty"`
	// accessKeySecret
	AccessKeySecret string `json:"access_key_secret,omitempty" xml:"access_key_secret,omitempty"`
	// bucketName
	BucketName string `json:"bucket_name,omitempty" xml:"bucket_name,omitempty"`
	// endPoint
	EndPoint string `json:"end_point,omitempty" xml:"end_point,omitempty"`
	// expiration
	Expiration string `json:"expiration,omitempty" xml:"expiration,omitempty"`
	// path
	Path string `json:"path,omitempty" xml:"path,omitempty"`
	// token
	Token string `json:"token,omitempty" xml:"token,omitempty"`
}

var poolStsUploadToken = sync.Pool{
	New: func() any {
		return new(StsUploadToken)
	},
}

// GetStsUploadToken() 从对象池中获取StsUploadToken
func GetStsUploadToken() *StsUploadToken {
	return poolStsUploadToken.Get().(*StsUploadToken)
}

// ReleaseStsUploadToken 释放StsUploadToken
func ReleaseStsUploadToken(v *StsUploadToken) {
	v.AccessKeyId = ""
	v.AccessKeySecret = ""
	v.BucketName = ""
	v.EndPoint = ""
	v.Expiration = ""
	v.Path = ""
	v.Token = ""
	poolStsUploadToken.Put(v)
}
